<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>业务类别维护</title>
		<meta name="description" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		
		<link rel="stylesheet" href="static/ace/css/bootstrap.css" />
		<link rel="stylesheet" href="static/ace/css/font-awesome.css" />
		
		<!-- text fonts -->
		<link rel="stylesheet" href="static/ace/css/ace-fonts.css" />
		<!-- ace styles -->
		<link rel="stylesheet" href="static/ace/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />
		<script type="text/javascript" src="static/js/jquery-1.7.2.js" />
		<script type="text/javascript">
			$(top.hangge());
		</script>
		<!--提示框-->
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
</head>
<body>
 <div class="main-container" id="main-container">
 	<div class="main-content">
 		<div class="main-content-inner">
 			<div class="page-content">
 				<div class="row">
 					<div class="col-xs-12">
 						<form action="domesticRouteMaintain/list" method="post" name="transportClauseForm" id="transportClauseForm">
 							<fieldset>
 								<table style="margin-top:5px;"class="table table-striped table-bordered table-hover">
 									<tr>
<!--  										<td style="width:79px;text-align: right;padding-top: 13px;">是否可用：</td> -->
<%-- 										<td><input type="text" name="ENABLE" id="ENABLE" value="${pd.ENABLE }" maxlength="32" style="width:98%;"/></td> --%>
										<td style="width:79px;text-align: right;padding-top: 13px;">是否可用：</td>
										<td>
											<select style="width:98%;"name="ENABLE">
											<option value=""></option>
											  <option value="1">是</option>
											  <option value="0">否</option>
											</select>
										</td>
										<td style="width:79px;text-align: right;padding-top: 13px;">航线名称：</td>
										<td><input type="text" name="ROUTE_NAME" id="ROUTE_NAME" value="${pd.ROUTE_NAME }" maxlength="32" style="width:98%;"/></td>
										
 									</tr>
 									<tr>
										<td style="width:79px;text-align: right;padding-top: 13px;">备注：</td>
										<td><textarea id="REMARK" name="REMARK"style="width:98%;"></textarea></td>
										<td style="text-align: left;" colspan="10">
										<a class="btn btn-xs btn-success">
											<i class="ace-icon fa fa-pencil-square-o bigger-120" onclick="add();">添加</i>
										</a>
									</td>
									</tr>
 								</table>
 							</fieldset>
						</form>
											<form action="domesticRouteMaintain/list" method="post" name="domesticRouteMaintain" id="domesticRouteMaintain">
											<fieldset>
											<table style="margin-top:5px;"class="table table-striped table-bordered table-hover">
											<tr>
												<td style="width:79px;text-align: right;padding-top: 13px;">航线名称：</td>
												<td><input type="text"  id="routeName" name="ROUTE_NAME" maxlength="32" style="width:98%;"/></td>
												
												<td style="text-align: left;" colspan="10">
												<a class="btn btn-xs btn-success">
													<i class="ace-icon fa fa-pencil-square-o bigger-120" onclick="serch();">查询</i>
												</a>
											</td>
											</tr>
											</table>
											</fieldset>
											</form>
											<table id="simple-table" class="table table-striped table-bordered table-hover" style="margin-top:5px;">
												<thead>
													<tr>
														<th class="center">航线名称</th>
														<th class="center">备注</th>
														<th class="center">是否可用</th>
														<th class="center">修改</th>
														<th class="center">删除</th>
													</tr>
												</thead>
												<tbody>
													<c:choose>
														<c:when test="${not empty domesticRoute}">
															<c:forEach items="${domesticRoute}" var="domesticRoute" varStatus="vs">
																<tr id="trId">
																<td class="center"  id="td1">${domesticRoute.ROUTE_NAME}</td>
																		<td class='center' style="width: 30px;"id="td2">${domesticRoute.REMARK}</td>
																		<c:if test="${domesticRoute.ENABLE ==1}">
																		<td class="center"id="td5">是</td>
																		</c:if>
																		<c:if test="${domesticRoute.ENABLE ==0}">
																		<td class="center" id="td5">否</td>
																		</c:if>
																		
																		<td class="center">
																		<div class="hidden-sm hidden-xs btn-group">
																			<a class="btn btn-xs btn-success" onclick="edit('${domesticRoute.ID}');">
																				<i class="ace-icon fa fa-pencil-square-o bigger-120">修改</i>
																			</a>
																		</div>
																		</td>
																		<td class="center">
																		<div class="hidden-sm hidden-xs btn-group">
																			<a class="btn btn-xs btn-success"onclick="deleteInfo('${domesticRoute.ID}');">
																				<i class="ace-icon fa fa-trash-o bigger-120">删除</i>
																			</a>
																		</div>
																		</td>		
																</tr>
															</c:forEach>
														</c:when>
													</c:choose>
												</tbody>
											</table>
 					</div>
 				</div>
 			</div>
 		</div>
 	</div>
 </div>
<!-- 		<div id="gsmLacciDayList"></div> -->
</body>
<script type="text/javascript">
function add(){
	if($("#ROUTE_NAME").val()==""){
		$("#ROUTE_NAME").tips({
			side:3,
            msg:'请填写航线名称',
            bg:'#AE81FF',
            time:2
        });
		$("#ROUTE_NAME").focus();
		$("#ROUTE_NAME").val('');
		$("#ROUTE_NAME").css("background-color","white");
		return false;
	}
	if($("#ENABLE").val()==""){
		$("#ENABLE").tips({
			side:3,
            msg:'请填写是否可用',
            bg:'#AE81FF',
            time:2
        });
		$("#ENABLE").focus();
		$("#ENABLE").val('');
		$("#ENABLE").css("background-color","white");
		return false;
	}

	 $.ajax({
         type: "POST",
         url: '<%=basePath%>domesticRouteMaintain/addDomesticRouteMaintainInfo',
         data: $("#transportClauseForm").serialize(),
         dataType: 'json',
         cache: false,
         success: function (data) {
        	 alert("保存成功")
        	 window.location.reload();
        	 
         }
     });
}
function edit(ID){
	 top.jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="编辑";
	 diag.URL = '<%=basePath%>domesticRouteMaintain/editDomesticRouteMaintainInfo?ID='+ID;
	 diag.Width = 469;
	 diag.Height = 510;
	 diag.CancelEvent = function(){ //关闭事件
		window.location.reload();
		diag.close();
	 };
	 diag.show();
}
function deleteInfo(ID){
	$.ajax({
        type: "POST",
        url: '<%=basePath%>domesticRouteMaintain/deleteDomesticRouteMaintainInfo?ID='+ID,
        dataType: 'json',
        cache: false,
        success: function (data) {
       	 window.location.reload();
       	 
        }
    });
}
function serch(){
	top.jzts();
	$("#domesticRouteMaintain").submit();
	}
// Ext.namespace('monitorAnalyzeReport');
// var monitorAnalyzeReport;
// Ext.onReady(function() {
// 	alert("2");
// 	alert("'${domesticRoute}'");
// // 	alert("'${domesticRouteTest}'");
// 	Ext.QuickTips.init();
// 	 var sm = new Ext.grid.CheckboxSelectionModel();
// 	var cm = new Ext.grid.ColumnModel([sm,
// 	{
// 		header : "ID",
// 		tooltip : "ID",
//    		width : 140,
//    		sortable : true,
//    		align:"left",
//    		dataIndex : 'ID'
// 	},
//    	{
//    		header : "航线名称",
//    		tooltip : "航线名称",
//    		width : 140,
//    		sortable : true,
//    		align:"left",
//    		dataIndex : 'ROUTE_NAME'
//    	},{
//    		header : "备注",
//    		tooltip : "备注",
//    		width : 120,
//    		align:"left",
//    		sortable : true,
//    		dataIndex : 'REMARK'
//    	},{
//    		header : "是否可用",
//    		tooltip : "是否可用",
//    		width : 80,
//    		sortable : true,
//    		align:"left",
//    		dataIndex : 'ENABLE'
   		
//    	}]);
//    	var reader = new Ext.data.JsonReader({
//    		root : 'domesticRouteInfo',
// //    		totalProperty : 'total',
// //    			type: 'json'
//    	}, [{
//    	    name: 'ID'
//    	},{
//    	    name: 'ROUTE_NAME'
//    	},{
//    	    name : 'REMARK'
//    	},{
//    	    name : 'ENABLE'
//    	}]);
//    	var jsonstore = new Ext.data.JsonStore({
<%--    			url : '<%=basePath%>domesticRouteMaintain/list',			 --%>
// 			reader : reader
//             });
//  var pager = new Ext.PagingToolbar({
//                  pageSize: 2,
//                  store: jsonstore,
//                  listeners: {
//                      "beforechange": function (bbar, params) {
//                          var grid = bbar.ownerCt;
//                          var store = grid.getStore();
//                          var start = params.start;
//                          var limit = params.limit;
//                          alert(store.getCount());
//                          return false;
//                      }
//                  }
//              });
//     var grid = new Ext.grid.GridPanel({
//     			 id : 'domesticRoute',
//     			 store : jsonstore,
//                  sm: sm,
//                  title: '国内航线维护',
//                  height: 200,
//                  store: jsonstore,
// //                  tbar: [tbtn],
//                  bbar: pager,
//                  colModel: cm,
//                  renderTo : 'gsmLacciDayList'
//              });
//     grid.getStore().reload();
// });


</script>
</html>